#pragma once

namespace a2d
{
//------------------------------------------------------------------

	template <class T>
	class Singleton
	{
	public:
		Singleton()
		{
			s_pInstance = static_cast<T*>(this);
		}

		virtual ~Singleton()
		{
			s_pInstance = nullptr;
		}

		static T* GetPtr()
		{
			return s_pInstance;
		}

		static T& Get()
		{
			return (*s_pInstance);
		}

	private:
		Singleton(const Singleton& Src) = delete;
		Singleton& operator=(const Singleton& Src) = delete;

		static T* s_pInstance;
	};

	template<class T> T* Singleton<T>::s_pInstance = nullptr;

//------------------------------------------------------------------
} // namespace a2d
